<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

<!--	<bean id="dataSource"-->
<!--		class="com.mchange.v2.c3p0.ComboPooledDataSource"-->
<!--		destroy-method="close">-->
<!--		<property name="driverClass" value="com.mysql.jdbc.Driver" />-->
<!--		<property name="jdbcUrl" value="jdbc:mysql://localhost:3306/hbi" />-->
<!--		<property name="user" value="root" />-->
<!--		<property name="password" value="" />-->
<!--		<property name="minPoolSize" value="2" />-->
<!--      	<property name="maxPoolSize" value="4" />-->
<!--	</bean>-->
	
	<bean id="hibernateSessionFactory"
		class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
		<property name="dataSource" ref="dataSource" />
<!--		<property name="configLocation" value="classpath:hibernate.cfg.xml"/>-->
		<property name="annotatedClasses">
			<list>
				<value>pms.om.Raum</value>
				<value>pms.om.BewDat</value>
				<value>pms.om.Person</value>
			</list>
		</property>
		<property name="hibernateProperties">
			<props>
				<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
				<prop key="hibernate.hbm2ddl.auto">update</prop>
				<prop key="hibernate.show_sql">true</prop>
				<prop key="hibernate.cache.provider_class">org.hibernate.cache.NoCacheProvider</prop>
			</props>
		</property>
	</bean>
	
	<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
		<property name="sessionFactory" ref="hibernateSessionFactory" />
	</bean>
	
	<!-- ******************* -->
	<!-- Data Access Objekte -->
	<!-- ******************* -->
	
	<bean id="personDao" class="pms.dao.PersonDao">
		<property name="sessionFactory" ref="hibernateSessionFactory" />
	</bean>
	
	<bean id="fahrtDao" class="pms.dao.BewDatDao">
		<property name="sessionFactory" ref="hibernateSessionFactory" />
	</bean>

	<bean id="raumDao" class="pms.dao.RaumDao">
		<property name="sessionFactory" ref="hibernateSessionFactory" />
		<property name="personDao" ref="personDao"/>
	</bean>

	<!-- ************** -->
	<!-- Die Controller -->
	<!-- ************** -->
	
	<bean name="HomeCo" class="pms.controller.Home" />
	
	<bean name="BilderAufnehmenCo" class="pms.controller.BilderAufnehmen" >
			<property name="personDao" ref="personDao"/>
	</bean>
	
	<bean name="AlleRaeumeCo" class="pms.controller.AlleRaeume">
		<property name="raumDao" ref="raumDao"/>
	</bean>
	
	<bean name="EditRaumCo" class="pms.controller.EditRaum">
		<property name="raumDao" ref="raumDao"/>
	</bean>

	<bean name="LoescheRaumCo" class="pms.controller.LoescheRaum">
		<property name="raumDao" ref="raumDao"/>
	</bean>	
	
	<bean name="NeuerRaumCo" class="pms.controller.EditRaum">
		<property name="raumDao" ref="raumDao"/>
	</bean>
	
	<bean name="SaveRaumCo" class="pms.controller.SaveRaum">
		<property name="raumDao" ref="raumDao"/>
	</bean>
	
	<bean name="AllePersonenCo" class="pms.controller.AllePersonen">
		<property name="personDao" ref="personDao"/>
	</bean>
	
	<bean name="EditPersonCo" class="pms.controller.EditPerson">
		<property name="personDao" ref="personDao"/>
	</bean>
	
	<bean name="NeuePersonCo" class="pms.controller.EditPerson">
		<property name="personDao" ref="personDao"/>
	</bean>
	
	<bean name="SavePersonCo" class="pms.controller.SavePerson">
		<description>pms.controller.SavePerson is a subclass of pms.controller.AllePersonen.
			This allows us to redirect to pms.controller.AllePersonen after saving.
			The property personDao has to be set anyway.</description>
		<property name="personDao" ref="personDao"/>
	</bean>
	
	<bean name="LoeschePersonCo" class="pms.controller.LoeschePerson">
		<description>pms.controller.LoeschePerson is a subclass of pms.controller.AllePersonen.
			This allows us to redirect to pms.controller.AllePersonen after deleting.
			The property personDao has to be set anyway.</description>
		<property name="personDao" ref="personDao"/>
	</bean>
	
	<bean name="FreierRaumCo" class="pms.controller.FreierRaum">
		<property name="raumDao" ref="raumDao"/>
	</bean>
	
	<bean name="AlleBewDatCo" class="pms.controller.AlleBewDat">
		<property name="fahrtDao" ref="fahrtDao"/>
		<property name="beende" value="false"/>
	</bean>

	<bean name="StartBewDatCo" class="pms.controller.StartBewDat">
		<property name="raumDao" ref="raumDao"/>
		<property name="personDao" ref="personDao"/>
	</bean>

	<bean name="AktuelleBewDatCo" class="pms.controller.AlleBewDat">
		<property name="fahrtDao" ref="fahrtDao"/>
		<property name="beende" value="true"/>
	</bean>
	
	<bean name="BeendeBewDatCo" class="pms.controller.AlleBewDat">
		<property name="fahrtDao" ref="fahrtDao"/>
		<property name="beende" value="true"/>
	</bean>
	
	<bean name="SaveBewDatCo" class="pms.controller.SaveBewDat">
		<property name="fahrtDao" ref="fahrtDao"/>
	</bean>
	
	<bean name="StopBewDatCo" class="pms.controller.StopBewDat">
		<property name="fahrtDao" ref="fahrtDao"/>
	</bean>	
	
</beans>
